isNumString
Strings Mar10 Timm Revised

Checking if a string contains a valid number

Problem
=======

How to check if a string contains a valid number?

Solution
========

Regular expressions will do the job. 

 function isNumString(x) {
	return x ~ \
      /^[+-]?([0-9]+[.]?[0-9]*|[.][0-9]+)([eE][+-]?[0-9]+)?$/
 }


   function IsNumStringDemo() {
       print "isNumString " isNumString("23.22E-100")
       print "isNumString " isNumString("a b")
   }

Author
======

Tim Menzies 

